package com.mvc.service.impl;

import com.mvc.dao.DogDao;
import com.mvc.dao.impl.DogDaoImpl;
import com.mvc.entity.Dog;
import com.mvc.service.DogService;

import java.util.List;

/**
 * @author wzm
 * @create 2023-06-26 10:28
 */
//service业务实现调用dao实现功能
public class DogServiceImpl implements DogService {
    //上层调用下层  私有化
    private DogDao dogDao = new DogDaoImpl();

    @Override
    public boolean addDog(Dog dog) {
        return dogDao.insertDog(dog) > 0;
    }

    @Override
    public boolean removeDog(Dog dog) {
        return dogDao.deleteDog(dog) > 0;
    }

    @Override
    public boolean modifyDog(Dog dog) {
        return dogDao.updateDog(dog) > 0;
    }

    @Override
    public Dog findById(Dog dog) {
        return dogDao.selectById(dog);
    }

    @Override
    public List<Dog> findByAll() {
        return dogDao.selectByAll();
    }
}
